package com.lg.consumer.controller;


import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.pojo.User;
import com.lg.consumer.proxy.RpcClientProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LgConsumerController {

    @Autowired
    private RpcClientProxy rpcClientProxy;

    @RequestMapping("getById")
    public User getById(Integer id){
        IUserService userService = (IUserService) rpcClientProxy.createProxy(IUserService.class);
        User user = userService.getById(id);
        return user;
    }

    @RequestMapping("find")
    public String getFin(){
        return "hello world!";
    }
}
